package com.order.entity;

import java.io.Serializable;
import java.sql.ResultSet;
import java.sql.SQLException;

import org.springframework.jdbc.core.RowMapper;

/**
 * 人员信息实体bean
 * @author xdc
 * @date 2014-11-6 下午03:48:32
 */
public class Person  implements Serializable{

	/**
	 * @Fields 
	 */
	private static final long serialVersionUID = 5819242652115816070L;
	
	/**
	 * 人员id
	 */
	private String id;
	
	/**
	 * 姓名
	 */
	private String name;
	
	/**
	 * 年龄
	 */
	private int age;

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		this.age = age;
	}

	/**
	 * 完整对象(解决不能多继承的问题)
	 */
	public static class PersonRowMapper extends Person implements RowMapper<Person>{

		private static final long serialVersionUID = 1L;

		public Person mapRow(ResultSet rs, int index)
				throws SQLException {
			
			Person person = new Person();
			person.setId(rs.getString("id"));
			person.setAge(rs.getInt("age"));
			person.setName(rs.getString("name"));
			
			return person;
		}
	}

}
